package com.ican.domain.user;

import java.io.Serializable;
import javax.persistence.*;

import com.ican.domain.common.BaseEntity;

import java.util.List;


/**
 * The persistent class for the user database table.
 * 
 */
@Entity
@Table(name="t_user")
public class User extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private String disName;
	private String name;
	private String password;
	private List<Role> roles;
	private List<Resources> resources;

    public User() {
    }


	@Column(name="dis_name")
	public String getDisName() {
		return this.disName;
	}
	public void setDisName(String disName) {
		this.disName = disName;
	}
	@Column(name="name", nullable = false)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name="password", nullable = false)
	public String getPassword() {
		return this.password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	@ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "t_user_role", joinColumns = { @JoinColumn(name = "user_id") }, 
                inverseJoinColumns = { @JoinColumn(name = "role_id") })
	public List<Role> getRoles() {
		return this.roles;
	}
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name="t_user_resources", joinColumns={@JoinColumn(name="user_id") }, 
	            inverseJoinColumns={@JoinColumn(name="resources_id")})
	public List<Resources> getResources() {
		return this.resources;
	}
	public void setResources(List<Resources> resources) {
		this.resources = resources;
	}
}